package com.meta.platform.contract.intf.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;


/**
 * 合同发票表
 *
 * @author M.simple
 * @email 1111111111111@qq.com
 * @date 2020-12-08 15:53:38
 */
@Data
public class ContractInvoice implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 自增主键
     */
    @ApiModelProperty("发票id")
    private Long id;

    /**
     * 合同id
     */
    @ApiModelProperty("合同id")
    private Long contractId;

    /**
     * 客户id
     */
    @ApiModelProperty("客户id")
    private Long customerId;

    /**
     * 开票抬头
     */
    @ApiModelProperty("开票抬头")
    private String invoiceTitle;

    /**
     * 抬头类型
     */
    @ApiModelProperty("抬头类型")
    private String titleType;

    /**
     * 开票类型
     */
    @ApiModelProperty("开票类型")
    private String invoiceCreateType;

    /**
     * 发票类型
     */
    @ApiModelProperty("发票类型")
    private String invoiceType;

    /**
     * 公司税号
     */
    @ApiModelProperty("公司税号")
    private String companyTaxNum;

    /**
     * 开票税率
     */
    @ApiModelProperty("开票税率")
    private String invoiceTaxRate;

    /**
     * 开票金额
     */
    @ApiModelProperty("开票金额")
    private BigDecimal invoiceAmount;

    /**
     * 开票时间
     */
    @ApiModelProperty("开票时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date invoiceDate;

    /**
     * 发票号码
     */
    @ApiModelProperty("发票号码")
    private String invoiceNum;

    /**
     * 租户ID
     */
    private Long tenantId;

    /**
     * 删除标志（0代表存在 1代表删除）
     */
    private Integer delFlag;

    /**
     * 创建者
     */
    @ApiModelProperty("创建者")
    private Long createBy;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新者
     */
    private Long updateBy;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String remark;

    @ApiModelProperty("发票附件id")
    private String invoiceFileIds;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ContractInvoice)) return false;
        ContractInvoice that = (ContractInvoice) o;
        return Objects.equals(getInvoiceTitle(), that.getInvoiceTitle()) &&
                Objects.equals(getTitleType(), that.getTitleType()) &&
                Objects.equals(getInvoiceCreateType(), that.getInvoiceCreateType()) &&
                Objects.equals(getInvoiceType(), that.getInvoiceType()) &&
                Objects.equals(getCompanyTaxNum(), that.getCompanyTaxNum()) &&
                Objects.equals(getInvoiceTaxRate(), that.getInvoiceTaxRate()) &&
                Objects.equals(getInvoiceAmount(), that.getInvoiceAmount()) &&
                Objects.equals(getInvoiceDate(), that.getInvoiceDate()) &&
                Objects.equals(getInvoiceNum(), that.getInvoiceNum()) &&
                Objects.equals(getRemark(), that.getRemark()) &&
                Objects.equals(getInvoiceFileIds(), that.getInvoiceFileIds());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getInvoiceTitle(), getTitleType(), getInvoiceCreateType(), getInvoiceType(), getCompanyTaxNum(),
                getInvoiceTaxRate(), getInvoiceAmount(), getInvoiceDate(), getInvoiceNum(), getRemark(), getInvoiceFileIds());
    }
}
